package game.algorithms;

import models.Board;
import play.Logger;

import java.util.Random;

/**
 * Class.java is a class for...
 *
 * @author finni
 * @version 1.0
 *          Created 24.11.2011 15:06
 */
public class GameAlgoSimple extends AbstractGameAlgorithms implements IGameAlgorithms
{
    public int getComputerMove(Board myBoard)
    {
        int n = -1;
        Random generator = new Random();
        boolean generate = true;
        while (generate)
        {
            n = generator.nextInt(9); // gefur tölu, frá 0 til 8
            if ( myBoard.getMark(n) == '-' )
                generate = false; //stop generation
        }
        Logger.info("Generated number: " + n);
        return n;
    }
}
